import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 课程体系信息 */
export interface Curriculum {
          curriculumId: number; // 课程体系ID
          majorId?: number; // 所属专业ID
          curriculumName?: string; // 课程体系名称
          curriculumCode?: string; // 课程体系编码
          version?: string; // 版本号
          effectiveYear?: string; // 生效年份
          totalCredits: number; // 总学分
          requiredCredits: number; // 必修学分
          electiveCredits: number; // 选修学分
          practicalCredits: number; // 实践学分
          description: string; // 课程体系描述
          status?: number; // 状态（0正常 1停用）
  }

// 课程体系 API
export const CurriculumApi = {
  // 查询课程体系分页
  getCurriculumPage: async (params: any) => {
    return await request.get({ url: `/ao/curriculum/page`, params })
  },

  // 查询课程体系详情
  getCurriculum: async (id: number) => {
    return await request.get({ url: `/ao/curriculum/get?id=` + id })
  },

  // 新增课程体系
  createCurriculum: async (data: Curriculum) => {
    return await request.post({ url: `/ao/curriculum/create`, data })
  },

  // 修改课程体系
  updateCurriculum: async (data: Curriculum) => {
    return await request.put({ url: `/ao/curriculum/update`, data })
  },

  // 删除课程体系
  deleteCurriculum: async (id: number) => {
    return await request.delete({ url: `/ao/curriculum/delete?id=` + id })
  },

  /** 批量删除课程体系 */
  deleteCurriculumList: async (ids: number[]) => {
    return await request.delete({ url: `/ao/curriculum/delete-list?ids=${ids.join(',')}` })
  },

  // 导出课程体系 Excel
  exportCurriculum: async (params) => {
    return await request.download({ url: `/ao/curriculum/export-excel`, params })
  },
}